﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Framework.UI.Controls"
                    xmlns:metro="http://schemas.codeplex.com/elysium"
                    xmlns:params="http://schemas.codeplex.com/elysium/params">
    <ResourceDictionary.MergedDictionaries>
        <controls:SharedResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Converter.xaml"/><controls:SharedResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Brush.xaml"/>
        <controls:SharedResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/FocusVisualStyle.xaml"/>
        <controls:SharedResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/Geometry.xaml"/>
        <controls:SharedResourceDictionary Source="/Framework.UI;component/Themes/Elysium/CommandButton.xaml"/>
        <controls:SharedResourceDictionary Source="/Framework.UI;component/Themes/ElysiumExtra/Icon.xaml"/>
        <controls:SharedResourceDictionary Source="/Framework.UI;component/Themes/ElysiumExtra/BorderFix.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>
        <Setter Property="Tag" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <controls:BorderFix Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            TextBlock.Foreground="{TemplateBinding Foreground}"
                            TextBlock.FontFamily="{TemplateBinding FontFamily}"
                            TextBlock.FontSize="{TemplateBinding FontSize}"
                            TextBlock.FontStretch="{TemplateBinding FontStretch}"
                            TextBlock.FontStyle="{TemplateBinding FontStyle}"
                            TextBlock.FontWeight="{TemplateBinding FontWeight}"
                            TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}"
                            TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}"
                            RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <Border x:Name="Bd"
                                        Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Top, Right', Path=Padding.Left, RelativeSource={RelativeSource TemplatedParent}}"
                                        SnapsToDevicePixels="true">
                                <Path x:Name="arrow" 
                                          Data="{StaticResource ArrowHeadDownGeometry}"
                                          Fill="{TemplateBinding Tag}"
                                          Height="18"
                                          HorizontalAlignment="Center" 
                                          Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Bottom', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                          RenderTransformOrigin="0.5,0.5" 
                                          Stretch="Uniform"
                                          VerticalAlignment="Center"
                                          Width="18">
                                    <Path.RenderTransform>
                                        <RotateTransform Angle="-90"/>
                                    </Path.RenderTransform>
                                </Path>
                            </Border>

                            <ContentPresenter x:Name="ContentPresenter" 
                                                  Grid.Row="1" 
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                  Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Right, Bottom', Path=Padding.Left, RelativeSource={RelativeSource TemplatedParent}}"              
                                                  RecognizesAccessKey="True"
                                                  SnapsToDevicePixels="True"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                        </Grid>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=Content, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
                            <Setter Property="Visibility" TargetName="ContentPresenter" Value="Collapsed"/>
                        </DataTrigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="arrow" 
                                                         Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                         Duration="00:00:00.3"
                                                         To="90"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="arrow" 
                                                         Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                         Duration="00:00:00.3"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>
        <Setter Property="Tag" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <controls:BorderFix Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            TextBlock.Foreground="{TemplateBinding Foreground}"
                            TextBlock.FontFamily="{TemplateBinding FontFamily}"
                            TextBlock.FontSize="{TemplateBinding FontSize}"
                            TextBlock.FontStretch="{TemplateBinding FontStretch}"
                            TextBlock.FontStyle="{TemplateBinding FontStyle}"
                            TextBlock.FontWeight="{TemplateBinding FontWeight}"
                            TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}"
                            TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}"
                            RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Border x:Name="Bd"
                                    Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Top, Bottom', Path=Padding.Left, RelativeSource={RelativeSource TemplatedParent}}"
                                    SnapsToDevicePixels="true">
                                <Path x:Name="arrow" 
                                      Data="{StaticResource ArrowHeadDownGeometry}"
                                      Fill="{TemplateBinding Tag}"
                                      Height="18"
                                      HorizontalAlignment="Center" 
                                      Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                      RenderTransformOrigin="0.5,0.5" 
                                      Stretch="Uniform"
                                      VerticalAlignment="Center"
                                      Width="18">
                                    <Path.RenderTransform>
                                        <RotateTransform Angle="180"/>
                                    </Path.RenderTransform>
                                </Path>
                            </Border>

                            <ContentPresenter x:Name="ContentPresenter" 
                                              Grid.Column="1"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Top, Right, Bottom', Path=Padding.Left, RelativeSource={RelativeSource TemplatedParent}}"
                                              SnapsToDevicePixels="True" 
                                              RecognizesAccessKey="True"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                        </Grid>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=Content, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
                            <Setter Property="Visibility" TargetName="ContentPresenter" Value="Collapsed"/>
                        </DataTrigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="arrow" 
                                                         Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                         Duration="00:00:00.3"
                                                         To="360"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="arrow" 
                                                         Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                         Duration="00:00:00.3"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="HorizontalAlignment" Value="Right"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>
        <Setter Property="Tag" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <controls:BorderFix Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            TextBlock.Foreground="{TemplateBinding Foreground}"
                            TextBlock.FontFamily="{TemplateBinding FontFamily}"
                            TextBlock.FontSize="{TemplateBinding FontSize}"
                            TextBlock.FontStretch="{TemplateBinding FontStretch}"
                            TextBlock.FontStyle="{TemplateBinding FontStyle}"
                            TextBlock.FontWeight="{TemplateBinding FontWeight}"
                            TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}"
                            TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}"
                            RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <Border x:Name="Bd" 
                                    Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Top, Right', Path=Padding.Left, RelativeSource={RelativeSource TemplatedParent}}"
                                    SnapsToDevicePixels="true">
                                <Path x:Name="arrow" 
                                      Data="{StaticResource ArrowHeadDownGeometry}"
                                      Fill="{TemplateBinding Tag}"
                                      Height="18"
                                      HorizontalAlignment="Center" 
                                      Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Bottom', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                      RenderTransformOrigin="0.5,0.5" 
                                      Stretch="Uniform"
                                      VerticalAlignment="Center"
                                      Width="18">
                                    <Path.RenderTransform>
                                        <RotateTransform Angle="90"/>
                                    </Path.RenderTransform>
                                </Path>
                            </Border>

                            <ContentPresenter x:Name="ContentPresenter" 
                                              Grid.Row="1"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Right, Bottom', Path=Padding.Left, RelativeSource={RelativeSource TemplatedParent}}"
                                              RecognizesAccessKey="True"
                                              SnapsToDevicePixels="True" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                        </Grid>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=Content, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
                            <Setter Property="Visibility" TargetName="ContentPresenter" Value="Collapsed"/>
                        </DataTrigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="arrow" 
                                                         Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                         Duration="00:00:00.3"
                                                         To="270"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="arrow" 
                                                         Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                         Duration="00:00:00.3"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>
        <Setter Property="Tag" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <controls:BorderFix Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Border x:Name="Bd"
                                    Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Top, Bottom', Path=Padding.Left, RelativeSource={RelativeSource TemplatedParent}}"
                                    SnapsToDevicePixels="true">
                                <Path x:Name="arrow" 
                                      Data="{StaticResource ArrowHeadDownGeometry}"
                                      Fill="{TemplateBinding Tag}"
                                      Height="18"
                                      HorizontalAlignment="Center" 
                                      Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                      RenderTransformOrigin="0.5,0.5" 
                                      Stretch="Uniform"
                                      VerticalAlignment="Center"
                                      Width="18">
                                    <Path.RenderTransform>
                                        <RotateTransform Angle="0"/>
                                    </Path.RenderTransform>
                                </Path>
                            </Border>

                            <ContentPresenter x:Name="ContentPresenter" 
                                              Grid.Column="1"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Top, Right, Bottom', Path=Padding.Left, RelativeSource={RelativeSource TemplatedParent}}"                                                  
                                              SnapsToDevicePixels="True" 
                                              RecognizesAccessKey="True"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                        </Grid>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=Content, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
                            <Setter Property="Visibility" TargetName="ContentPresenter" Value="Collapsed"/>
                        </DataTrigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="arrow" 
                                                         Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                         Duration="00:00:00.3"
                                                         To="180"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="arrow" 
                                                         Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                         Duration="00:00:00.3"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Type Expander}" TargetType="{x:Type Expander}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="Background" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <controls:BorderFix BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <DockPanel>
                            <ToggleButton x:Name="HeaderSite" 
										  DockPanel.Dock="Top" 
                                          Background="{TemplateBinding Background}" 
							              BorderBrush="{TemplateBinding BorderBrush}" 
                                          Content="{TemplateBinding Header}" 
										  ContentTemplate="{TemplateBinding HeaderTemplate}" 
										  ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"  
                                          FocusVisualStyle="{TemplateBinding FocusVisualStyle}" 
										  FontFamily="{TemplateBinding FontFamily}" 
										  FontSize="{TemplateBinding FontSize}" 
										  FontStretch="{TemplateBinding FontStretch}" 
										  FontStyle="{TemplateBinding FontStyle}" 
										  FontWeight="{TemplateBinding FontWeight}" 
                                          Foreground="{TemplateBinding Foreground}"
                                          IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                          IsTabStop="True"
										  MinHeight="0" 
										  MinWidth="0" 
                                          Padding="{TemplateBinding Padding}"
                                          Style="{StaticResource ExpanderDownHeaderStyle}"
                                          Tag="{StaticResource ContrastBrush}"/>
                            <controls:ExpandableContentControl x:Name="ExpandSite"
											                   DockPanel.Dock="Bottom"
                                                               Content="{TemplateBinding Content}"
                                                               ContentTemplate="{TemplateBinding ContentTemplate}"
                                                               ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
											                   Focusable="false"
                                                               FontFamily="{TemplateBinding FontFamily}"
                                                               FontSize="{TemplateBinding FontSize}"
                                                               FontStretch="{TemplateBinding FontStretch}"
                                                               FontStyle="{TemplateBinding FontStyle}"
                                                               FontWeight="{TemplateBinding FontWeight}"
                                                               Foreground="{StaticResource ForegroundBrush}"
											                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                               HorizontalContentAlignment="Stretch"
                                                               Percentage="0"
                                                               RecalculateOnSizeChanged="True"
                                                               RevealMode="{TemplateBinding ExpandDirection}" 
											                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                               VerticalContentAlignment="Stretch"/>
                        </DockPanel>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{StaticResource ForegroundBrush}"/>
                            <Setter Property="BorderBrush" Value="{StaticResource ForegroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsExpanded" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard x:Name="ExpandedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="CollapsedBeginStoryboard"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="CollapsedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       BeginTime="00:00:00.3" 
                                                                       Duration="00:00:00">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <ObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </ObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="ExpandedBeginStoryboard"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderRightHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderUpHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="HorizontalAlignment" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TransparentExpanderStyle" BasedOn="{StaticResource {x:Type Expander}}" TargetType="{x:Type Expander}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <controls:BorderFix BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <DockPanel>
                            <ToggleButton x:Name="HeaderSite" 
										  DockPanel.Dock="Top" 
                                          Background="{TemplateBinding Background}" 
							              BorderBrush="{TemplateBinding BorderBrush}" 
                                          Content="{TemplateBinding Header}" 
										  ContentTemplate="{TemplateBinding HeaderTemplate}" 
										  ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"  
                                          FocusVisualStyle="{TemplateBinding FocusVisualStyle}" 
										  FontFamily="{TemplateBinding FontFamily}" 
										  FontSize="{TemplateBinding FontSize}" 
										  FontStretch="{TemplateBinding FontStretch}" 
										  FontStyle="{TemplateBinding FontStyle}" 
										  FontWeight="{TemplateBinding FontWeight}" 
                                          Foreground="{TemplateBinding Foreground}"
                                          IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                          IsTabStop="True"
										  MinHeight="0" 
										  MinWidth="0" 
                                          Padding="{TemplateBinding Padding}"
                                          Style="{StaticResource ExpanderDownHeaderStyle}"
                                          Tag="{StaticResource AccentBrush}"/>
                            <controls:ExpandableContentControl x:Name="ExpandSite"
											                   DockPanel.Dock="Bottom"
                                                               Content="{TemplateBinding Content}"
                                                               ContentTemplate="{TemplateBinding ContentTemplate}"
                                                               ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
											                   Focusable="false"
                                                               FontFamily="{TemplateBinding FontFamily}"
                                                               FontSize="{TemplateBinding FontSize}"
                                                               FontStretch="{TemplateBinding FontStretch}"
                                                               FontStyle="{TemplateBinding FontStyle}"
                                                               FontWeight="{TemplateBinding FontWeight}"
                                                               Foreground="{StaticResource ForegroundBrush}"
											                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                               HorizontalContentAlignment="Stretch"
                                                               Percentage="0"
                                                               RecalculateOnSizeChanged="True"
                                                               RevealMode="{TemplateBinding ExpandDirection}" 
											                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                               VerticalContentAlignment="Stretch"/>
                        </DockPanel>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Tag" TargetName="HeaderSite" Value="{StaticResource ForegroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsExpanded" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard x:Name="ExpandedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="CollapsedBeginStoryboard"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="CollapsedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       BeginTime="00:00:00.3" 
                                                                       Duration="00:00:00">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <ObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </ObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="ExpandedBeginStoryboard"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderRightHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderUpHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="HorizontalAlignment" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="NoHeaderExpanderStyle" BasedOn="{StaticResource {x:Type Expander}}" TargetType="{x:Type Expander}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <controls:BorderFix BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <DockPanel>
                            <controls:ExpandableContentControl x:Name="ExpandSite"
											                   DockPanel.Dock="Bottom"
                                                               Content="{TemplateBinding Content}"
                                                               ContentTemplate="{TemplateBinding ContentTemplate}"
                                                               ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
											                   Focusable="false"
                                                               FontFamily="{TemplateBinding FontFamily}"
                                                               FontSize="{TemplateBinding FontSize}"
                                                               FontStretch="{TemplateBinding FontStretch}"
                                                               FontStyle="{TemplateBinding FontStyle}"
                                                               FontWeight="{TemplateBinding FontWeight}"
                                                               Foreground="{StaticResource ForegroundBrush}"
											                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                               HorizontalContentAlignment="Stretch"
                                                               Percentage="0"
                                                               RecalculateOnSizeChanged="True"
                                                               RevealMode="{TemplateBinding ExpandDirection}" 
											                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                               VerticalContentAlignment="Stretch"/>
                        </DockPanel>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard x:Name="ExpandedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="CollapsedBeginStoryboard"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="CollapsedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       BeginTime="00:00:00.3" 
                                                                       Duration="00:00:00">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <ObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </ObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="ExpandedBeginStoryboard"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="HorizontalAlignment" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="NonAnimatedExpanderStyle" TargetType="{x:Type Expander}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="Background" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <controls:BorderFix BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <DockPanel>
                            <ToggleButton x:Name="HeaderSite" 
										  DockPanel.Dock="Top" 
                                          Background="{TemplateBinding Background}" 
							              BorderBrush="{TemplateBinding BorderBrush}" 
                                          Content="{TemplateBinding Header}" 
										  ContentTemplate="{TemplateBinding HeaderTemplate}" 
										  ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"  
                                          FocusVisualStyle="{TemplateBinding FocusVisualStyle}" 
										  FontFamily="{TemplateBinding FontFamily}" 
										  FontSize="{TemplateBinding FontSize}" 
										  FontStretch="{TemplateBinding FontStretch}" 
										  FontStyle="{TemplateBinding FontStyle}" 
										  FontWeight="{TemplateBinding FontWeight}" 
                                          Foreground="{TemplateBinding Foreground}"
                                          IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                          IsTabStop="True"
										  MinHeight="0" 
										  MinWidth="0" 
                                          Padding="{TemplateBinding Padding}"
                                          Style="{StaticResource ExpanderDownHeaderStyle}"
                                          Tag="{StaticResource ContrastBrush}"/>
                            <ContentControl x:Name="ExpandSite"
											DockPanel.Dock="Bottom"
                                            Content="{TemplateBinding Content}"
                                            ContentTemplate="{TemplateBinding ContentTemplate}"
                                            ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
											Focusable="false"
                                            FontFamily="{TemplateBinding FontFamily}"
                                            FontSize="{TemplateBinding FontSize}"
                                            FontStretch="{TemplateBinding FontStretch}"
                                            FontStyle="{TemplateBinding FontStyle}"
                                            FontWeight="{TemplateBinding FontWeight}"
                                            Foreground="{StaticResource ForegroundBrush}"
											HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                            HorizontalContentAlignment="Stretch"
											VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                            VerticalContentAlignment="Stretch"
                                            Visibility="Collapsed"/>
                        </DockPanel>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{StaticResource ForegroundBrush}"/>
                            <Setter Property="BorderBrush" Value="{StaticResource ForegroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsExpanded" Value="true">
                            <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderRightHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderUpHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="HorizontalAlignment" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Flyout -->
    <Style x:Key="FlyoutToggleCommandButtonStyle" TargetType="{x:Type metro:ToggleCommandButton}">
        <Style.Resources>
            <DataTemplate x:Key="PressedContentTemplate">
                <controls:Icon Foreground="{StaticResource ContrastBrush}"
                               Size="Medium"
                               Style="{Binding}"/>
            </DataTemplate>
            <DataTemplate x:Key="DisabledContentTemplate">
                <controls:Icon Foreground="{Binding RelativeSource={RelativeSource AncestorType={x:Type metro:ToggleCommandButton}}, Path=BorderBrush, Mode=OneWay}"
                               Size="Medium"
                               Style="{Binding}"/>
            </DataTemplate>
        </Style.Resources>
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldThickness), Mode=OneWay}"/>
        <Setter Property="params:CommandButtons.Mask" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.HeaderFontSize)}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <controls:Icon Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type metro:ToggleCommandButton}}}" 
                                   Size="Medium"
                                   Style="{Binding}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type metro:ToggleCommandButton}">
                    <Grid Background="{StaticResource TransparentBrush}" 
                          TextBlock.Foreground="{TemplateBinding Foreground}" 
                          TextBlock.FontFamily="{TemplateBinding FontFamily}" 
                          TextBlock.FontSize="{TemplateBinding FontSize}" 
                          TextBlock.FontStretch="{TemplateBinding FontStretch}" 
                          TextBlock.FontStyle="{TemplateBinding FontStyle}" 
                          TextBlock.FontWeight="{TemplateBinding FontWeight}"
                          TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}" 
                          TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}" 
                          RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}" 
                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Ellipse x:Name="PART_Decor" 
                                 Fill="{TemplateBinding Background}"
                                 Height="40"
                                 Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                 Stroke="{TemplateBinding BorderBrush}" 
                                 Stretch="Fill" 
                                 StrokeThickness="{Binding Converter={StaticResource ThicknessToDoubleConverter}, Path=BorderThickness, RelativeSource={RelativeSource TemplatedParent}}"
                                 Width="40"/>
                        <ContentPresenter x:Name="PART_ContentHost" 
                                          Content="{TemplateBinding Content}" 
                                          ContentStringFormat="{TemplateBinding ContentStringFormat}" 
                                          ContentTemplate="{TemplateBinding ContentTemplate}" 
                                          ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" 
                                          HorizontalAlignment="Center" 
                                          Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                          RecognizesAccessKey="true" 
                                          VerticalAlignment="Center"/>
                        <Border x:Name="PART_HeaderHost" 
                                Grid.Column="1"
                                Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}">
                            <ContentPresenter Content="{TemplateBinding Header}" 
                                              ContentStringFormat="{TemplateBinding HeaderStringFormat}" 
                                              ContentTemplate="{TemplateBinding HeaderTemplate}" 
                                              ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" 
                                              HorizontalAlignment="Stretch"
                                              VerticalAlignment="Center"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Header" Value="{x:Null}">
                            <Setter TargetName="PART_HeaderHost" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="Tag" Value="True">
                            <Setter TargetName="PART_Decor" Property="Grid.Column" Value="2"/>
                            <Setter TargetName="PART_ContentHost" Property="Grid.Column" Value="2"/>
                            <Setter TargetName="PART_HeaderHost" Property="Margin" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=FontSize, Mode=OneWay, Converter={StaticResource IsGreaterThanConverter}, ConverterParameter=18}">
                <Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
            </DataTrigger>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource LowlightBrush}"/>
                <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
                <Setter Property="Foreground" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="true">
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource MiddleLightBrush}"/>
                <Setter Property="ContentTemplate" Value="{StaticResource PressedContentTemplate}"/>
                <Setter Property="Background" Value="{StaticResource AccentBrush}"/>
                <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
                <Setter Property="Foreground" Value="{StaticResource AccentBrush}"/>
            </Trigger>
            <!--<Trigger Property="IsChecked" Value="True">
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource MiddleLightBrush}"/>
                <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}"/>
                <Setter Property="Foreground" Value="{StaticResource MiddleLightBrush}"/>
            </Trigger>-->
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource DisabledBrush}"/>
                <Setter Property="ContentTemplate" Value="{StaticResource DisabledContentTemplate}"/>
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="FlyoutUpToggleCommandButtonStyle" BasedOn="{StaticResource FlyoutToggleCommandButtonStyle}"  TargetType="{x:Type metro:ToggleCommandButton}">
        <Setter Property="Content" Value="{StaticResource ArrowHeadUpIconStyle}"/>
    </Style>
    <Style x:Key="FlyoutDownToggleCommandButtonStyle" BasedOn="{StaticResource FlyoutToggleCommandButtonStyle}"  TargetType="{x:Type metro:ToggleCommandButton}">
        <Setter Property="Content" Value="{StaticResource ArrowHeadDownIconStyle}"/>
    </Style>
    <Style x:Key="FlyoutLeftToggleCommandButtonStyle" BasedOn="{StaticResource FlyoutToggleCommandButtonStyle}"  TargetType="{x:Type metro:ToggleCommandButton}">
        <Setter Property="Content" Value="{StaticResource ArrowHeadLeftIconStyle}"/>
        <Setter Property="Tag" Value="True"/>
    </Style>
    <Style x:Key="FlyoutRightToggleCommandButtonStyle" BasedOn="{StaticResource FlyoutToggleCommandButtonStyle}"  TargetType="{x:Type metro:ToggleCommandButton}">
        <Setter Property="Content" Value="{StaticResource ArrowHeadRightIconStyle}"/>
    </Style>
    <Style x:Key="FlyoutExpanderStyle" TargetType="{x:Type Expander}">
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="Background" Value="{StaticResource BackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldThickness), Mode=OneWay}"/>
        <Setter Property="ExpandDirection" Value="Left"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.ContentFontSize), Mode=OneWay}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <controls:BorderFix Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <controls:ExpandableContentControl x:Name="PART_ExpandableContent"
                                                           Focusable="false"
                                                           FontFamily="{TemplateBinding FontFamily}"
                                                           FontSize="{TemplateBinding FontSize}"
                                                           FontStretch="{TemplateBinding FontStretch}"
                                                           FontStyle="{TemplateBinding FontStyle}"
                                                           FontWeight="{TemplateBinding FontWeight}"
                                                           Foreground="{StaticResource ForegroundBrush}"
                                                           HorizontalAlignment="Stretch"
                                                           HorizontalContentAlignment="Stretch"
                                                           Percentage="0"
                                                           RecalculateOnSizeChanged="True"
                                                           RevealMode="{TemplateBinding ExpandDirection}" 
                                                           VerticalAlignment="Stretch"
                                                           VerticalContentAlignment="Stretch">
                            <Grid Margin="12">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>

                                <metro:ToggleCommandButton x:Name="PART_Header"
                                                           FocusVisualStyle="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}" 
										                   FontFamily="{TemplateBinding FontFamily}" 
                                                           FontSize="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.HeaderFontSize)}"
                                                           FontStretch="{TemplateBinding FontStretch}" 
										                   FontStyle="{TemplateBinding FontStyle}" 
										                   FontWeight="{TemplateBinding FontWeight}" 
                                                           IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                                           IsTabStop="True"
                                                           Margin="{TemplateBinding Padding}"
                                                           Opacity="0">
                                    <metro:ToggleCommandButton.Header>
                                        <ContentPresenter ContentSource="Header"/>
                                    </metro:ToggleCommandButton.Header>
                                </metro:ToggleCommandButton>

                                <Border x:Name="PART_Content"
                                        Grid.Row="1"
                                        KeyboardNavigation.DirectionalNavigation="Contained"
                                        KeyboardNavigation.TabIndex="2"
                                        KeyboardNavigation.TabNavigation="Local">
                                    <ContentPresenter Focusable="False"
                                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                      Margin="{TemplateBinding Padding}"
                                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                </Border>

                            </Grid>
                        </controls:ExpandableContentControl>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard x:Name="ExpandedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ExpandableContent" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Header" 
                                                                       Storyboard.TargetProperty="Opacity"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="CollapsedBeginStoryboard"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="CollapsedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ExpandableContent" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Header" 
                                                                       Storyboard.TargetProperty="Opacity"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" 
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       BeginTime="00:00:00.3" 
                                                                       Duration="00:00:00">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <ObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </ObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="ExpandedBeginStoryboard"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Down">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Bottom', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="Grid.Row" TargetName="PART_Header" Value="2"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource FlyoutUpToggleCommandButtonStyle}"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource FlyoutLeftToggleCommandButtonStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Up', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource FlyoutDownToggleCommandButtonStyle}"/>
                            <Setter Property="VerticalAlignment" Value="Bottom"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="HorizontalAlignment" Value="Right"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource FlyoutRightToggleCommandButtonStyle}"/>
                        </Trigger>
                        <Trigger Property="IsExpanded" Value="False">
                            <Setter Property="BorderThickness" Value="0"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ContrastFlyoutToggleCommandButtonStyle" BasedOn="{StaticResource FlyoutToggleCommandButtonStyle}" TargetType="{x:Type metro:ToggleCommandButton}">
        <Setter Property="BorderBrush" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource LowlightBrush}"/>
                <Setter Property="BorderBrush" Value="{StaticResource LowlightBrush}" />
                <Setter Property="Foreground" Value="{StaticResource LowlightBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="true">
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource MiddleLightBrush}"/>
                <Setter Property="Background" Value="{StaticResource MiddleLightBrush}"/>
                <Setter Property="BorderBrush" Value="{StaticResource MiddleLightBrush}"/>
                <Setter Property="Foreground" Value="{StaticResource MiddleLightBrush}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="params:CommandButtons.Mask" Value="{StaticResource DisabledBrush}"/>
                <Setter Property="BorderBrush" Value="{StaticResource DisabledBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="ContrastFlyoutUpToggleCommandButtonStyle" BasedOn="{StaticResource ContrastFlyoutToggleCommandButtonStyle}"  TargetType="{x:Type metro:ToggleCommandButton}">
        <Setter Property="Content" Value="{StaticResource ArrowHeadUpIconStyle}"/>
    </Style>
    <Style x:Key="ContrastFlyoutDownToggleCommandButtonStyle" BasedOn="{StaticResource ContrastFlyoutToggleCommandButtonStyle}"  TargetType="{x:Type metro:ToggleCommandButton}">
        <Setter Property="Content" Value="{StaticResource ArrowHeadDownIconStyle}"/>
    </Style>
    <Style x:Key="ContrastFlyoutLeftToggleCommandButtonStyle" BasedOn="{StaticResource ContrastFlyoutToggleCommandButtonStyle}"  TargetType="{x:Type metro:ToggleCommandButton}">
        <Setter Property="Content" Value="{StaticResource ArrowHeadLeftIconStyle}"/>
        <Setter Property="Tag" Value="True"/>
    </Style>
    <Style x:Key="ContrastFlyoutRightToggleCommandButtonStyle" BasedOn="{StaticResource ContrastFlyoutToggleCommandButtonStyle}"  TargetType="{x:Type metro:ToggleCommandButton}">
        <Setter Property="Content" Value="{StaticResource ArrowHeadRightIconStyle}"/>
    </Style>
    <Style x:Key="AccentFlyoutExpanderStyle" BasedOn="{StaticResource FlyoutExpanderStyle}" TargetType="{x:Type Expander}">
        <Setter Property="Background" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <controls:BorderFix Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <controls:ExpandableContentControl x:Name="PART_ExpandableContent"
                                                           Focusable="false"
                                                           FontFamily="{TemplateBinding FontFamily}"
                                                           FontSize="{TemplateBinding FontSize}"
                                                           FontStretch="{TemplateBinding FontStretch}"
                                                           FontStyle="{TemplateBinding FontStyle}"
                                                           FontWeight="{TemplateBinding FontWeight}"
                                                           Foreground="{StaticResource ForegroundBrush}"
                                                           HorizontalAlignment="Stretch"
                                                           HorizontalContentAlignment="Stretch"
                                                           Percentage="0"
                                                           RecalculateOnSizeChanged="True"
                                                           RevealMode="{TemplateBinding ExpandDirection}" 
                                                           VerticalAlignment="Stretch"
                                                           VerticalContentAlignment="Stretch">
                            <Grid Margin="12">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>

                                <metro:ToggleCommandButton x:Name="PART_Header"
                                                           FocusVisualStyle="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}" 
										                   FontFamily="{TemplateBinding FontFamily}" 
                                                           FontSize="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.HeaderFontSize)}"
                                                           FontStretch="{TemplateBinding FontStretch}" 
										                   FontStyle="{TemplateBinding FontStyle}" 
										                   FontWeight="{TemplateBinding FontWeight}" 
                                                           IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                                           IsTabStop="True"
                                                           Margin="{TemplateBinding Padding}"
                                                           Opacity="0">
                                    <metro:ToggleCommandButton.Header>
                                        <ContentPresenter ContentSource="Header"/>
                                    </metro:ToggleCommandButton.Header>
                                </metro:ToggleCommandButton>

                                <Border x:Name="PART_Content"
                                        Grid.Row="1"
                                        KeyboardNavigation.DirectionalNavigation="Contained"
                                        KeyboardNavigation.TabIndex="2"
                                        KeyboardNavigation.TabNavigation="Local">
                                    <ContentPresenter Focusable="False"
                                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                      Margin="{TemplateBinding Padding}"
                                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                </Border>

                            </Grid>
                        </controls:ExpandableContentControl>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard x:Name="ExpandedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ExpandableContent" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Header" 
                                                                       Storyboard.TargetProperty="Opacity"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="CollapsedBeginStoryboard"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="CollapsedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ExpandableContent" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Header" 
                                                                       Storyboard.TargetProperty="Opacity"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" 
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       BeginTime="00:00:00.3" 
                                                                       Duration="00:00:00">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <ObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </ObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="ExpandedBeginStoryboard"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Down">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Bottom', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="Grid.Row" TargetName="PART_Header" Value="2"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource ContrastFlyoutUpToggleCommandButtonStyle}"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource ContrastFlyoutLeftToggleCommandButtonStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Up', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource ContrastFlyoutDownToggleCommandButtonStyle}"/>
                            <Setter Property="VerticalAlignment" Value="Bottom"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="HorizontalAlignment" Value="Right"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource ContrastFlyoutRightToggleCommandButtonStyle}"/>
                        </Trigger>
                        <Trigger Property="IsExpanded" Value="False">
                            <Setter Property="BorderThickness" Value="0"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="DarkFlyoutExpanderStyle" BasedOn="{StaticResource FlyoutExpanderStyle}" TargetType="{x:Type Expander}">
        <Setter Property="Background" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ContrastBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <controls:BorderFix Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="True">
                        <controls:ExpandableContentControl x:Name="PART_ExpandableContent"
                                                           Focusable="false"
                                                           FontFamily="{TemplateBinding FontFamily}"
                                                           FontSize="{TemplateBinding FontSize}"
                                                           FontStretch="{TemplateBinding FontStretch}"
                                                           FontStyle="{TemplateBinding FontStyle}"
                                                           FontWeight="{TemplateBinding FontWeight}"
                                                           Foreground="{StaticResource ForegroundBrush}"
                                                           HorizontalAlignment="Stretch"
                                                           HorizontalContentAlignment="Stretch"
                                                           Percentage="0"
                                                           RecalculateOnSizeChanged="True"
                                                           RevealMode="{TemplateBinding ExpandDirection}" 
                                                           VerticalAlignment="Stretch"
                                                           VerticalContentAlignment="Stretch">
                            <Grid Margin="12">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>

                                <metro:ToggleCommandButton x:Name="PART_Header"
                                                           FocusVisualStyle="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}" 
										                   FontFamily="{TemplateBinding FontFamily}" 
                                                           FontSize="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.HeaderFontSize)}"
                                                           FontStretch="{TemplateBinding FontStretch}" 
										                   FontStyle="{TemplateBinding FontStyle}" 
										                   FontWeight="{TemplateBinding FontWeight}" 
                                                           IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                                           IsTabStop="True"
                                                           Margin="{TemplateBinding Padding}"
                                                           Opacity="0">
                                    <metro:ToggleCommandButton.Header>
                                        <ContentPresenter ContentSource="Header"/>
                                    </metro:ToggleCommandButton.Header>
                                </metro:ToggleCommandButton>

                                <Border x:Name="PART_Content"
                                        Grid.Row="1"
                                        KeyboardNavigation.DirectionalNavigation="Contained"
                                        KeyboardNavigation.TabIndex="2"
                                        KeyboardNavigation.TabNavigation="Local">
                                    <ContentPresenter Focusable="False"
                                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                      Margin="{TemplateBinding Padding}"
                                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                </Border>

                            </Grid>
                        </controls:ExpandableContentControl>
                    </controls:BorderFix>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard x:Name="ExpandedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ExpandableContent" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Header" 
                                                                       Storyboard.TargetProperty="Opacity"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="CollapsedBeginStoryboard"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="CollapsedBeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_ExpandableContent" 
                                                                       Storyboard.TargetProperty="(controls:ExpandableContentControl.Percentage)"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_Header" 
                                                                       Storyboard.TargetProperty="Opacity"
                                                                       BeginTime="00:00:00">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3" KeySpline="0.2,0,0,1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" 
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       BeginTime="00:00:00.3" 
                                                                       Duration="00:00:00">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <ObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </ObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                                <StopStoryboard BeginStoryboardName="ExpandedBeginStoryboard"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Down">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Bottom', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="Grid.Row" TargetName="PART_Header" Value="2"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource ContrastFlyoutUpToggleCommandButtonStyle}"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Right', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource ContrastFlyoutLeftToggleCommandButtonStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Up', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource ContrastFlyoutDownToggleCommandButtonStyle}"/>
                            <Setter Property="VerticalAlignment" Value="Bottom"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="BorderThickness" Value="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left', RelativeSource={RelativeSource Self}, Path=(params:General.SemiBoldPaddingValue), Mode=OneWay}"/>
                            <Setter Property="HorizontalAlignment" Value="Right"/>
                            <Setter Property="Style" TargetName="PART_Header" Value="{StaticResource ContrastFlyoutRightToggleCommandButtonStyle}"/>
                        </Trigger>
                        <Trigger Property="IsExpanded" Value="False">
                            <Setter Property="BorderThickness" Value="0"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>